# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=gpg-tui
pkgver=0.9.0
pkgrel=0
pkgdesc="Terminal user interface for GnuPG"
url="https://github.com/orhun/gpg-tui"
license="MIT"
arch="all !s390x !riscv64" # blocked by rust/cargo
makedepends="cargo gpgme-dev libxcb-dev libxkbcommon-dev libgpg-error-dev"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/orhun/gpg-tui/archive/v$pkgver/gpg-tui-$pkgver.tar.gz"

build() {
	cargo build --release --locked

	mkdir completions
	OUT_DIR=completions cargo run --release --bin gpg-tui-completions
}

check() {
	cargo test --release --locked
}

package() {
	install -Dm755 target/release/$pkgname "$pkgdir"/usr/bin/$pkgname

	install -Dm644 man/$pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1

	install -Dm644 completions/$pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completions/$pkgname.fish "$pkgdir"/usr/share/fish/completions/$pkgname.fish
	install -Dm644 completions/_$pkgname "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
c34474af908c693c1e62ba9638d62c8278e80c5f9a80cca6346bdef6590d25f9959c060444b91b15a750a2760c91d685dd596bf1a5717ab5b28ef4e2482beae7  gpg-tui-0.9.0.tar.gz
"
